import { createContext } from 'unctx'
import type {NuxtApp} from "#app";

const ctx = createContext<NuxtApp>({
    asyncContext: import.meta.server
})
export function setNuxtApp(nuxtApp: NuxtApp) {
    if (ctx.tryUse()) return
    ctx.set(nuxtApp)
}

export function getNuxtApp() {
    return ctx.tryUse()
}
